Eismann / Setup / BeanStalk Server Setup
BeanStalk Server
-
1. Beanstalk environment
1. setup beanstalk environment
1. Goto https://eu-central-1.console.aws.amazon.com/elasticbeanstalk/home?region=eu-central-1#/environments
2. New Environment: Click on 'Create New Environment' button
3. Environment tier: Select 'Web server environment' from Select environment tier
4. platform: Select 'Managed platform' from Platform
5. Application code : Select 'Sample application' from Application code
2.Security Settings
1. set 'aws-elasticbeanstalk-service-role' for 'service role' in the Service role tab
2. set 'beanstalk_live_server' for 'EC2 key pair' in the Virtual machine permissions
3. set 'eismann-fieldservice-lambda-role' for 'IAM instance profile' in the Virtual machine permissions
3. Network Settings
1. set 'vpc-04e9704ad04cded18 (172.20.16.0/24) | Eismann Fahrer App' for 'VPC' in the Virtual private cloud (VPC) tab
2. set 'public' for 'visibility' in the tab 'Load balancer settings'
3. select 'Eismann Fahrer App 1A', 'Eismann Fahrer App 1B' and 'Eismann Fahrer App 1C' for 'Load balancer subnets'
4. select 'Eismann Fahrer App 1A', 'Eismann Fahrer App 1B' and 'Eismann Fahrer App 1C' for 'Instance subnets'
4. Capacity Settings
1. set 'load balancer or custom balancer' for Environment type
2. set no. of 'instances' min and max
3. select 'r6g.large' for 'instance type'
4. set load balancer parameters for triggering instances
5. Create and save
6. Software Settings
1. set 'memory limit' : 512
2. set 'execution time' : 60
7. Security Group
1. sg-0acf0ad2024ce2715 & sg-025848453f4bb3903 are automatically created and assigned when creating a new environment 2. We should assign all other security groups what we wants 3. Load balance is automatically created. To confirm it, go to 'Load balancer' under 'Load Balancing' in the left side menu 4.Target group is automatically created. To confirm it, go to 'Target Group' under 'Load Balancing' in the left side menu -
2. Environment properties
1. Software Settings
1. select 'your environment' from the list of BeanStalk environment
2. select 'configuration' link
3. edit 'software'
4. add 'servicecloud_mode' = 'production' in 'Environment properties'
-
3. Code Deployment
1. Using Beanstalk
1. select 'your environment' from the list of BeanStalk environment
2. zip all files inside the project root folder (don't zip project root folder)
3. upload zipped file
-
8. Load Balancer Settings
Load balancer info
To check the load balancer, copy DNS name and paste in the browser. (awseb--awseb-fu0uoxxgm9t9-1987232262.eu-central-1.elb.amazonaws.com) 1. Target Group
1) Target Group is automatically generated when creating the beanstalk.
2) It is automatically asigned to the http:80 of the load balancer . (see >> Load Balances >> select your load balancer >> Listeners and rules tab)2. Security Group
1) VPC security group and Load balancer security group are automatically generated when creating new beanstalk
2) Load balancer security group is automatically assigned to load balancer (see >> Load balancers >> select your load balancer >> security tab)3.Enable https in Load Balancer
Load balancers list1. select a load balancer from the load balancers list
Load balancer listener
2. select 'listeners' tab
3. Click 'Add listener' button
Target group mapping4. select 'HTTPS' for protocol option
5. select 'forward to' for default action
6. select 'Load balancer target Group' from the 'target group'
SSl certificate mapping7. select security policy
8. select SSL certificate source
Output4. Add HTTPS rule to load balancer Security group
1. go to security group
2. select security group of load balancer
security group details3. edit 'inbound rule'
Add new rule4. add 'HTTPS'
5. Add HTTPS rule to VPC Security group
1. select security group of VPC
Security group details2. edit 'inbound rule'
Add new rule3. click add button
4. select https
5. assign same security group of http rule in the source ( load balancer security group)
-
2. Domain Mapping
1. go to Route 53
2. Select 'domain name' from the list
3. select "A" record from the domain name records
4. edit record
5. set "A" for Record type
6. select 'Alias' option
7. set "clasic load balancer" in the Route traffic
8. select "DNS name of load balancer" in the Route traffic
-
9. Code Deployement using git
1. go to bitbucket.org
2. select the project
3. select repository settings of your project
4. click on repository variables
5. set APPLICATION_NAME & APPLICATION_ENVIRONMENT
-
4. Add security group of BeanStalk into Elastic Search Security Group
1. go to security group
2. select 'sg-01756afc7e3de3959 eismann-fieldservice-es' of elastic search
3. edit 'inbound rule'
4. add 'HTTPS' rule and assign security group id of beanstalk instance 'sg-025848453f4bb3903'
Env Data settings
1. open terminal
2. connect to EC2 using ssh
1. Create new Auth
2. GET AUTHcurl -XPOST https://vpc-eismann-fieldservice-es3-dmnjzh7jbk3bhhjgoo4kgybefy.eu-central-1.es.amazonaws.com:443/_bulk -H 'Content-Type: application/json' -d ' {"index": {"_index": "servicecloud-dev-auth", "_type": "servicecloud-dev-auth"}} { "key": "test", "secret": "test", "permission": { "AdministratorAccess": true, "fieldservice": true},"name": "SAP", "salesOrganisations": ["Admin" ],"synced":false,"settings":[]} '
3. DELETE AUTHcurl -XGET https://vpc-eismann-fieldservice-es3-dmnjzh7jbk3bhhjgoo4kgybefy.eu-central-1.es.amazonaws.com:443/servicecloud-dev-auth/_search curl -XDELETE https://vpc-eismann-fieldservice-es3-dmnjzh7jbk3bhhjgoo4kgybefy.eu-central-1.es.amazonaws.com:443/servicecloud-dev-auth/servicecloud-dev-auth/I0IoGI4By9F7SwBL5YVj I0IoGI4By9F7SwBL5YVj is id of the doc which getting when reading the doc 4. Create Credentials
5. Get datacurl -XPOST https://vpc-eismann-fieldservice-es3-dmnjzh7jbk3bhhjgoo4kgybefy.eu-central-1.es.amazonaws.com:443/_bulk -H 'Content-Type: application/json' -d ' {"index": {"_index": "servicecloud-dev-credential", "_type": "servicecloud-dev-credential"}} { "key": "fieldservice_sap", "data": { "dbPass" : "root","app_store_sap_user" : "CPIC_EVA20","redirectUrl" : "http://18.184.221.91:443/sso/response.php","karlson_url" : "https://www.eismannsuchtkunde.de/EismannApi/api/sales/savetosales","dbName" : "servicecloud_db","nearest_cust_password" : "YW1AYWN0Z21iaC5pbmZvOjdTU2RRcjZ5MVdpVk10VXp1a2IxekE9PQ==","promio_url" : "https://api.promio-mail.com/1.4/soap/13775.wsdl","app_store_sap_pass" : "appFro\\$t","karlson_apikey" : "7SSdQr6y1WiVMtUzukb1zA==","oneSignalApiSecret" : "ZTk5MWUzNjctYTkwZC00OTk0LWI4ZGUtNzM1NDAzYjI3Mjdm","app_store_salesman_number" : "3088108402","dbUser" : "root","web_mail_password" : "Carping14","app_store_sap_url" : "http://deeissapq22.erp.eismann.eu:8002/sap/bc/srt/wsdl/srvc_005056BC561F1ED9A5E59F3366D001C8/wsdl11/allinone/standard/document?sap-client=010","sap_url" : "http://deeissapc12ci.erp.eismann.eu:8003/sap/bc/srt/wsdl/srvc_005056BC0FCD1EE9A5FF6900E80AD62E/wsdl11/allinone/standard/document?sap-client=010","portalScheme" : "https://","portalOauthSalt" : "X23Mkd8JdR35e36f83j767vg3575GCT","app_store_org" : "3088","portalOauthClient" : "Dsfgsf3rpreview-dev-live","web_mail_email" : "Pischel","dbHost" : "localhost","oneSignalApiId" : "45d7ce54-5717-4c5c-8d53-f830757355ab","profile_image_url" : "http://api.pressmind.net/image.php?w=100&h=150&api=17d4118d4547b2acfcd369c18abacb58&fn=","karlson_gpsUrl" : "https://www.eismannsuchtkunde.de/EismannApi/api/sales/savetogps","app_store_username" : "pischel","dbDrive" : "mysql","portalDomain" : "preview.eismannportal.de","promio_email" : "vpischel@t-online.de","karlson_findSalesmanUrl" : "https://www.eismannsuchtkunde.de/EismannApi/api/sales/getsaledata","sap_user" : "CPIC_EVA20","portalOauthPassword" : "12gh91jkFG87VW6FGb-dev-live","oneSignalApi" : "https://onesignal.com/api/v1/notifications","promio_apikey" : "4F94410244A6B858b5Be4D035DdDEc4A","nearest_cust_url" : "https://www.eismannsuchtkunde.de/WebServicenew/FindNearestCustomers.ashx","sap_pass" : "appFro\\$t","shop_product_token" : "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJFaXNtYW5uIEFQUCIsImlhdCI6MTQ1NjQ0MTIwMCwiZXhwIjo0MTAyMzU0ODAwLCJhdWQiOm51bGwsInN1YiI6IkVpc21hbm4gQVBQIn0.r-pnQSjYcaiN6pQf5FfnReBHrUYyTkv9gKY2r9kdWTA","shop_product_url" : "https://shop.eismann.de/deeismannapi/v2/assortment/fetch","karlson_sap_url" : "http://deeissapc12ci.erp.eismann.eu:8003/sap/bc/srt/wsdl/srvc_005056BC0FCD1ED8BFE88DE175216D25/wsdl11/allinone/standard/document?sap-client=010","karlson_sap_user" : "cpic_karlson","karlson_sap_pass" : "sonne01","ENCRYPTION_KEY" : "MX!yG^6bM#H8BMfZW5VwBoZAROeFQroa8V0Zk11Rz#prxK#Mzt","sap_sfdc_url" : "http://deeissapq22.erp.eismann.eu:8002/sap/bc/srt/wsdl/srvc_005056BC561F1EE8B9E7C8EC9D163D99/wsdl11/allinone/standard/document?sap-client=010","sap_sfdc_user" : "CPIC_EVA20", "sap_sfdc_pass" : "appFro\\$t","sap_zsc_sfdc_user" : "CPIC_EVA20","sap_zsc_sfdc_pass" : "appFro\\$t","sap_zsc_sfdc_url" : "http://deeissapc12ci.erp.eismann.eu:8003/sap/bc/srt/wsdl/srvc_005056BC0FCD1EE8B787B5AEC4C69F07/wsdl11/allinone/standard/document?sap-client=010","ses_password" : "BMtnjWXA4wbw0cZlH4KEA+/kPAIjwOgUeejJ6erenwbI","ses_sender_name" : "FahrerAPP","ses_sender_email" : "FahrerAPP@eis.mn","ses_username" : "AKIAIJUWZZSJEJZU3JGA","ses_host" : "email-smtp.eu-west-1.amazonaws.com","oneSignalApiId_RVL" : "9e200245-acc3-4c48-b7b2-f99111924011","oneSignalApiSecret_RVL" : "M2QyYzM3ZjItOGJiMy00NWI4LTlmYmQtNTdkMzBiODNhNTAw","sap_pass_shop" : "tiEf\\$shopQ22#70","sap_url_shop" : "http://deeissapc12ci.erp.eismann.eu:8003/sap/bc/srt/wsdl/srvc_005056BC0FCD1EE9A5FF738333EFB62E/wsdl11/allinone/standard/document?sap-client=010","sap_user_shop" : "cpic_shop","karlson_umsatz_25_url" : "http://deeissapc12ci.erp.eismann.eu:8003/sap/bc/srt/wsdl/srvc_005056BC11D81EE696CAB95AA6DE08E8/wsdl11/allinone/standard/document?sap-client=010","karlson_umsatz_25_user" : "cpic_karlson","karlson_umsatz_25_pass" : "sonne01","karlson_sap_pass_eva" : "appFro\\$t","karlson_sap_user_eva" : "cpic_eva20","eshop_customer_user" : "cpic_promio","eshop_customer_pass" : "ad64ks","eshop_customer_url" : "http://deeissapq22.erp.eismann.eu:8002/sap/bc/srt/wsdl/flv_10002A101AD1/bndg_url/sap/bc/srt/rfc/sap/zsfa_ws_customer_options/010/zsfa_ws_customer_options_2019111/q22?sap-client=010", "emis_server":"10.36.1.9", "emis_instance":"EMIS","emis_port":"49556","emis_database":"EMIS", "emis_uid":"GRAPHQL", "emis_password":"eis\\$3g%" },"synced" : true} '
6. UPDATEcurl -XGET https://vpc-eismann-fieldservice-es3-dmnjzh7jbk3bhhjgoo4kgybefy.eu-central-1.es.amazonaws.com:443/servicecloud-dev-credential/_search curl -XPOST 'https://vpc-eismann-fieldservice-es3-dmnjzh7jbk3bhhjgoo4kgybefy.eu-central-1.es.amazonaws.com:443/servicecloud-dev-credential/servicecloud-dev-credential/zvNGGI4BLg_LQOpe-twl/_update?pretty' -d '{"doc":{"data":{"sap_url":"http://deeissapc12ci.erp.eismann.eu:8003/sap/bc/srt/wsdl/flv_10002A101AD1/bndg_url/sap/bc/srt/rfc/sap/zeva20_ws_all/010/zeva20_ws_20210915/c12?sap-client=010"}}}' -H 'Content-Type: application/json' zvNGGI4BLg_LQOpe-twl is id of the doc 7. Deletecurl -XDELETE https://vpc-eismann-fieldservice-es3-dmnjzh7jbk3bhhjgoo4kgybefy.eu-central-1.es.amazonaws.com:443/servicecloud-dev-credential/servicecloud-dev-credential/zvNGGI4BLg_LQOpe-twl zvNGGI4BLg_LQOpe-twl is id of the doc -
8. Add Security group of Beanstalk into RDS security group
1. go to security group
2. select 'RDS' security group 'sg-0e3c3e5fe1325fad3 eismann-fieldservice-rds'
3. edit inbound rule
4. select 'MYSQL/Aurora' and assign security group of beanstalk 'sg-025848453f4bb3903'
Install mysql package for connecting RDS
sudo dnf update -y sudo dnf install mariadb105-server EXPORT
mysqldump -p -h servicecloud1.cieqcoyvplol.eu-central-1.rds.amazonaws.com -P 3306 -u root servicecloud_db > servicecloud_db.sql IMPORT
mysql -p -h servicecloud1.cieqcoyvplol.eu-central-1.rds.amazonaws.com -P 3306 -u root servicecloud_test < servicecloud_db.sql DB Connect
mysql -h servicecloud1.cieqcoyvplol.eu-central-1.rds.amazonaws.com -P 3306 -u root -p -
8. Debugging
1. Database driver issue
IssueRead / write does not work
SolutionFor AWS: "illuminate/database": "^11.0"
For AZURE: "illuminate/database":"5.1.8"